package com.theflashblog.examples {	import flash.display.Graphics;	import flash.display.MovieClip;	import flash.text.TextField;	import flash.text.TextFormat;		/**	 * @author Ralph Hauwert / UnitZeroOne	 */	public class BoxSprite extends MovieClip {				private static var objectCounter:int = 0;				public function BoxSprite()		{			objectCounter++;			draw();			}				protected function draw():void		{			var g : Graphics = graphics;			g.beginFill(Math.random()*0xFFFFFF, 1);			g.drawRect(-50, -50, 100, 100);			g.endFill();						var tft : TextFormat = new TextFormat();			tft.font = "Arial";			tft.size = 40;			tft.color = 0xFFFFFF;						var tf : TextField = new TextField();			tf.defaultTextFormat = tft;			tf.autoSize = "center";			tf.selectable = false;						tf.text = objectCounter.toString();			tf.x = -tf.textWidth/2;			tf.y = -tf.textHeight/2;			addChild(tf);						cacheAsBitmap = true;		}	}}